#include "Obj.h"

Obj::Obj()
{
    cout << "Init"<<endl;
}

Obj::~Obj()
{
    cout <<"Dest"<<endl;
}

void Obj::Init(){
    cout << "init"<<endl;
}

void Obj::Dest(){
    cout <<"dest"<<endl;
}

static void use_malloc_free(){
    Obj* a = (Obj*)malloc(sizeof(Obj));
    a->Init();
    a->Dest();
}

static void use_new_free(){
    Obj* a = new Obj();
    a->Init();
    a->Dest();
    delete a;
}

int main(){
    //use_malloc_free();
    use_new_free();
    return 0;
}
